import { createElement, HTMLAttributes, type FC } from 'react';
import classNames from 'classnames';

import { feedExtraDefaultProps } from './defaultProps';
import type { FeedExtraOptions } from './type';

export interface FeedExtraProps extends FeedExtraOptions, HTMLAttributes<HTMLDivElement> {}

const FeedExtra: FC<FeedExtraProps> = (props) => {
  const { className, text, images, children, forwardedRef, ...feedExtraProps } = props;

  return createElement(
    'div',
    { ref: forwardedRef, className: classNames('extra', { text, images }, className), ...feedExtraProps },
    children,
  );
};

FeedExtra.displayName = 'FeedExtra';
FeedExtra.defaultProps = feedExtraDefaultProps;

export default FeedExtra;
